#define _CRT_SECURE_NO_WARNINGS 1
#include"Stack.h"
void TestBin(int n)
{
	Stack s2;
	while (n)
	{
		s2.StackPush(n % 2);
		n /= 2;
	}
	while (!s2.StackEmpty())
	{
		cout << s2.GetTop();
		s2.StackPop();
	}
	cout << " " << endl;
}
void TestOct(int n)
{
	Stack s1;
	while (n)
	{
		s1.StackPush(n % 8);
		n /= 8;
	}
	while (!s1.StackEmpty())
	{
		cout << s1.GetTop();
		s1.StackPop();
	}
	cout << " " << endl;
}

void TestHex(int n)
{
	Stack s3;
	while (n)
	{
		s3.StackPush(n % 16);
		n /= 16;
	}

	while (!s3.StackEmpty())
	{
		DataType ret = s3.GetTop();
		if (ret <= 9)
		{
			cout << ret;
		}
		else
		{
			switch (ret)
			{
			case 10:
				cout << "A";
				break;
			case 11:
				cout << "B";
				break;
			case 12:
				cout << "C";
				break;
			case 13:
				cout << "D";
				break;
			case 14:
				cout << "E";
				break;
			case 15:
				cout << "F";
				break;
			}
		}
		s3.StackPop();
	}
	cout << " " << endl;
}
int main()
{
	int n = 0;
	cin >> n;
	TestBin(n);
	TestOct(n);
	TestHex(n);

	
	return 0;
}